package com.bjpowernode.模拟JDBC本质;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.Properties;
import java.util.ResourceBundle;

/**
 * @author LittleDesire
 * @description java程序员角色，去调用sun数据库公司写好的（数据库驱动）连接数据库
 * @date 2022-03-01 周二 9:33
 * @since 17
 */
public class JavaProgrammer {
    public static void main(String[] args) {
        try {
            //ResourceBundle bundle = ResourceBundle.getBundle("jdbc");
            InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("jdbc.properties");
            Properties prop = new Properties();
            try {
                prop.load(is);
                String className = prop.getProperty("className");
                //String className = bundle.getString("className");
                Class<?> c = Class.forName(className);
                JDBC jdbc = (JDBC)c.getDeclaredConstructor().newInstance();
                jdbc.getConnection();
            } catch (IOException e) {
                e.printStackTrace();
            }

        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
            e.printStackTrace();
        }
    }
}
